package org.example.classtopia.Utils;

import cn.hutool.core.util.StrUtil;

public class RegexUtils {
    private static boolean isMatch(String str, String regex){
        if(StrUtil.isBlank(str)){
            return true;
        }
        return str.matches(regex);
    }//TRUE则匹配，FALSE则不匹配

    public static boolean isEmail(String email){
        return isMatch(email, RegexPatterns.EMAIL_REGEX);
    }

    public static boolean isVerifyCode(String verifyCode){
        return isMatch(verifyCode, RegexPatterns.VERIFY_CODE_REGEX);
    }
}

